/* 
 *  Incub - incubate your baby robot
 *  Copyright (C) 2008 Stanislaw Szymczyk
 *  e-mail: sszymczy@gmail.com   www: http://cogville.cog-lab.com
 *
 *  This file is part of Incub.
 *
 *  Incub is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  Incub is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with Incub.  If not, see <http://www.gnu.org/licenses/>.
 * 
 */
 
#ifndef MATERIAL_H_
#define MATERIAL_H_

#include <string>
#include <exception>

class Color {
	public: float r, g, b;
};

class Material {
	private:
	std::string name;
	bool touchSensitive;
	float touchResolution;
	static std::string default_name;
	Color ambient, diffuse, specular, emission;
	float shininess;
	float density;
	float friction; // friction coefficient mu
	float resilience; // colliding bodies form a spring-damper
	float damping; // system with these parameters
	public:
	Material();
	void setName(std::string&);
	std::string& getName();
	static std::string& getDefaultName();
	void setAmbient(std::string);
	void setDiffuse(std::string);
	void setSpecular(std::string);
	void setEmission(std::string);
	void setShininess(std::string);
	void setDensity(std::string);
	void setFriction(std::string);
	void setResilience(std::string);
	void setDamping(std::string);
	Color& getAmbient();
	Color& getDiffuse();
	Color& getSpecular();	
	Color& getEmission();	
	float getShininess();
	float getDensity();
	float getFriction();
	float getResilience();
	float getDamping();
	class Exception : public std::exception {
		protected: std::string msg;
		public: 
		Exception(char *m) { msg = std::string(m); }
		virtual const char* what() const throw() { return msg.c_str(); }
		virtual ~Exception() throw() {};
	};
	class NoSuchMaterialException: public Exception
	{
		public: NoSuchMaterialException(char *msg) : Exception((char*)("I couldn't find material " + std::string(msg)).c_str()) { };
	};
};

#endif /*MATERIAL_H_*/
